#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>

int minDistance(int a, int b, int c) {
    int point[3] = { a, b, c };
    for (int i = 0; i < 2; i++) {
        for (int j = i + 1; j < 3; j++) {
            if (point[i] > point[j]) {
                int t = point[i];
                point[i] = point[j];
                point[j] = t;
            }
        }
    }

    int mindistance = abs(point[0] - point[1]) + abs(point[1] - point[2]);
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            for (int k = -1; k <= 1; k++) {
                int newa = point[0] + i;
                int newb = point[1] + j;
                int newc = point[2] + k;
                int sb = abs(newa - newb) + abs(newb - newc);
                if (sb < mindistance) {
                    mindistance = sb;
                }
            }
        }
    }
    return mindistance;
}

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int min = minDistance(a, b, c);
    printf("%d\n", min);
    return 0;
}